export default {
	data() {
		return {
			//设置默认的分享参数
			share: {
				title: '零工就近聘小程序',
				path: '/pages/index/index',
				imageUrl: '',
				desc: '',
				content: ''
			}
		}
	},
	//#ifdef MP-WEIXIN
	onShareAppMessage(res) {
		console.log(res)
		let that = this;
		const pages = getCurrentPages();
		const currentPage = pages[pages.length - 1];
		const route = currentPage.route;
		let params=currentPage.options;
		const queryString = Object.keys(params).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
		    .join('&');
		let path=`${route}?${queryString}`
		console.log(path)
		if (res.from === 'menu') {
			return {
				title: "找工作,发职位-百灵鸟灵工驿站",
				path: path,
				imageUrl: "",
				desc: "",
				content: "",
				success(res) {},
				fail(res) {
					uni.showToast({
						title: '分享失败',
						icon: 'none'
					})
				}
			}
		} else {
			return {
				title: this.share.title,
				path: this.share.path,
				imageUrl: this.share.imageUrl,
				desc: this.share.desc,
				content: this.share.content,
				success(res) {

				},
				fail(res) {
					uni.showToast({
						title: '分享失败',
						icon: 'none'
					})
				}
			}
		}
	}
	//#endif
}